package com.mall.controller;

import com.mall.beans.Rotation;
import com.mall.service.RotationService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * id:主键
 * imgUrl:图片地址
 * url:跳转地址
 * bacolor:背景色
 * order:顺序
 * title:标题(Rotation)表控制层
 *
 * @author 曾涛
 * @since 2020-12-22 11:31:27
 */
@RestController
@RequestMapping("rotation")
public class RotationController {
    /**
     * 服务对象   RotationService
     */
    @Resource
        private RotationService rotationService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Rotation selectOne(Integer id) {
        return this.rotationService.queryById(id);
    }

    /*轮播图批量查询*/
    @GetMapping("all")
    public List<Rotation> all(){
        return rotationService.all();
    }

}